﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
@Html.Partial("LoadPanelPartial")
<head>
    <title>PropALLEdit</title>
        @if (false)
    {
        <script src="../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>
    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)


    <script type="text/javascript">
        function OK() {
            lpModal.Show();
            var types = ASPxClientRadioButtonList.Cast("type").GetValue();
            var sNO = "";
           
            switch (types) {
                case "1":
                    sNO = $("#hidnoList").val();
                    break;
                case "2":
                    sNO = $("#hidpageNoList").val();
                    break;
                case "3":
                    sNO = $("#hidstrwhere").val();
                    break;
            }



            if (FEnterprisePropNo.GetValue() == "" || FEnterprisePropNo.GetValue() == null) {
                alert("请选择企业性质");
                lpModal.Hide();
                return;
            }

            if (FFinancePropNo.GetValue() == "" || FFinancePropNo.GetValue() == null) {
                alert("请选择资金性质");
                lpModal.Hide();
                return;
            }

            $.ajax({
                type: 'POST',
                url: rootPath + '/TaxPayerManager/ExistsProp',
                data: { noList: sNO, type: types },
                success: function (result) {
                    if (result == "3") {
                        alert("系统异常");
                        lpModal.Hide();
                    }
                    else if (result == "1") {
                        form1.submit();
                    }
                    else {
                        if (confirm("您所选择的数据中包含已设置企业，是否进行替换操作？")) {
                            form1.submit();
                        }
                        else {
                            lpModal.Hide();
                        }
                    }
                }
            });

        }

        $(document).ready(function () {
            var hdjsAlert = $("#hdjsAlert").val();
            if (hdjsAlert != "") {
                alert(hdjsAlert);
                lpModal.Hide();
            }
            if (hdjsAlert == "操作成功") {
                lpModal.Hide();
                parent.codeOK();
            }
            Changed();
        });

        function Changed() {
            $.ajax({
                type: 'POST',
                url: rootPath + '/TaxPayerManager/GetList',
                data: { fEnterprisePropNo: ASPxClientComboBox.Cast("FEnterprisePropNo").GetValue() },
                success: function (result) {
                    ASPxClientComboBox.Cast("FFinancePropNo").ClearItems()
                    var List = JSON.parse(result);
                    for (var i = 0; i < List.length; i++) {
                        ASPxClientComboBox.Cast("FFinancePropNo").AddItem(List[i].FFinancePropShortName, List[i].FFinancePropNo, "");
                    }
                }
            });
        }
    </script>

</head>
<body>
    <div>
    
    @using (Html.BeginForm("PropALLSave", "TaxPayerManager", FormMethod.Post, new { id = "form1" }))
    {
    <table class="tableFrom">
          <tr>
            <th style=" width:150">
              企业性质:</th>
            <td>
                @Html.DevExpress().ComboBox(settings =>
               {
                   settings.Name = "FEnterprisePropNo";
                   settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                   settings.Properties.TextField = "FEnterprisePropName";
                   settings.Properties.ValueField = "FEnterprisePropNo";
                   settings.Properties.ClientSideEvents.SelectedIndexChanged = "Changed";
               }).BindList(ViewData["EnterprisePropList"]).GetHtml()
            </td>
        </tr>
        <tr>
            <th style=" width:150">
              资金性质:</th>
            <td>
                 @Html.DevExpress().ComboBox(settings =>
               {
                   settings.Name = "FFinancePropNo";
                   settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
                   settings.Properties.TextField = "FFinancePropShortName";
                   settings.Properties.ValueField = "FFinancePropNo";
                   settings.Properties.EnableClientSideAPI = true;
               }).GetHtml()
              
            </td>
        </tr>
        <tr>
        <th>修改方式:</th>
        <td>@Html.DevExpress().RadioButtonList(settings =>
     {
         settings.Name = "type";
         settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Table;
         settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
         settings.Properties.RepeatColumns = 3;
         settings.Properties.ValueField = "Value";
         settings.Properties.TextField = "Text";
         settings.SelectedIndex = 0;
         settings.Width = System.Web.UI.WebControls.Unit.Pixel(400);
     }).BindList(new List<SelectListItem> { 
                           new SelectListItem { Text = "仅选中记录", Value = "1" }, 
                             new SelectListItem { Text = "当前页面查询结果", Value = "2" }, 
                           new SelectListItem { Text = "所有页面查询结果", Value = "3" }
                           
     }).Bind("1").GetHtml()</td>
        </tr>
        </table>
        
         @Html.Hidden("hidnoList", ViewData["noList"])
         @Html.Hidden("hidpageNoList", ViewData["pageNoList"])
         @Html.Hidden("hidstrwhere", ViewData["strwhere"])
         @Html.Hidden("hdjsAlert", (ViewData["jsAlert"]));

    }
    </div>
</body>
</html>
